package com.itlong.cloud.enumerate;

import lombok.Getter;

/**
 * <desc>
 *      一卡通授权凭证类型枚举
 * </desc>
 *
 * @Author Zhu.yj
 * @createDate  2020/9/21
 */
public enum SmartCardAuthEvidenceTypeEnum {

    IC_CARD(3, "IC/CPU",1),
    CPU_CARD(3,"IC/CPU",1),
    INTELLIGENT_SENSING_CARD(4, "智能感应卡",2),
    PHONE(8, "电话",3),
    FINGERPRINTS(16, "指纹",4),
    EMAIL(32,"邮箱",5),
    FACE(64, "人脸",6),
    IC_TO_ID(128, "ic转id",7),
    VISITOR(256, "访客",8),
    ATTENDANCE(512, "考勤",9),
    SECURITY(1024, "安防",10),
    ID_CARD(2048, "身份证",11),
    SHARE_ELEVATOR(4096,"共享电梯",12),
    UNKOWNTYPE(3, "未知类型",-1),                //未知设备类型
    ;
    @Getter
    private int code;  //授权编码

    @Getter
    private String description;  //类型描述（名称）

    private int type;


    SmartCardAuthEvidenceTypeEnum(int code, String description, int type){
        this.description = description;
        this.code = code;
        this.type = type;
    }

    /**
     * <desc>
     *      获取授权编码
     * </desc>
     *
     * @Author Zhu.yj
     * @createDate  2020/9/21
     */
    public int getCode(){
        return this.code;
    }

    /**
     * <desc>
     *      获取类型
     * </desc>
     *
     * @Author Zhu.yj
     * @createDate  2020/9/21
     */
    public int getType(){
        return this.type;
    }

    /**
     * <desc>
     *      根据类型获取枚举类
     * </desc>
     *
     * @Author Zhu.yj
     * @createDate  2020/9/23
     */
    public static SmartCardAuthEvidenceTypeEnum getByType(int type){
        for (SmartCardAuthEvidenceTypeEnum value : values()){
            if(value.getType() == type){
                return value;
            }
        }
        return UNKOWNTYPE;
    }
}
